package o;

import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;

public class dsc {
    public static void ˋ(File file, ZipOutputStream zipOutputStream, String str) throws IOException {
        Closeable fileInputStream;
        Closeable bufferedInputStream;
        Throwable th;
        Throwable th2;
        Closeable closeable = null;
        if (file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File file2 : listFiles) {
                    if (!(!file2.exists() || file2.isDirectory() || file2.getName().equals(str))) {
                        ˋ(file2, zipOutputStream, "");
                    }
                }
                return;
            }
            return;
        }
        byte[] bArr = new byte[1048576];
        try {
            fileInputStream = new FileInputStream(file);
            try {
                bufferedInputStream = new BufferedInputStream(fileInputStream, 1048576);
            } catch (Exception e) {
                bufferedInputStream = null;
                closeable = fileInputStream;
                try {
                    Logger.ˋ("FileUtils", "zipFile, Exception:");
                    dnw.ˎ(bufferedInputStream);
                    dnw.ˎ(closeable);
                } catch (Throwable th3) {
                    th = th3;
                    fileInputStream = closeable;
                    closeable = bufferedInputStream;
                    th2 = th;
                    dnw.ˎ(closeable);
                    dnw.ˎ(fileInputStream);
                    throw th2;
                }
            } catch (Throwable th4) {
                th2 = th4;
                dnw.ˎ(closeable);
                dnw.ˎ(fileInputStream);
                throw th2;
            }
            try {
                zipOutputStream.putNextEntry(new ZipEntry(file.getName()));
                while (true) {
                    int read = bufferedInputStream.read(bArr);
                    if (read != -1) {
                        zipOutputStream.write(bArr, 0, read);
                    } else {
                        zipOutputStream.flush();
                        zipOutputStream.closeEntry();
                        dnw.ˎ(bufferedInputStream);
                        dnw.ˎ(fileInputStream);
                        return;
                    }
                }
            } catch (Exception e2) {
                closeable = fileInputStream;
                Logger.ˋ("FileUtils", "zipFile, Exception:");
                dnw.ˎ(bufferedInputStream);
                dnw.ˎ(closeable);
            } catch (Throwable th5) {
                th = th5;
                closeable = bufferedInputStream;
                th2 = th;
                dnw.ˎ(closeable);
                dnw.ˎ(fileInputStream);
                throw th2;
            }
        } catch (Exception e3) {
            bufferedInputStream = null;
            Logger.ˋ("FileUtils", "zipFile, Exception:");
            dnw.ˎ(bufferedInputStream);
            dnw.ˎ(closeable);
        } catch (Throwable th6) {
            th2 = th6;
            fileInputStream = null;
            dnw.ˎ(closeable);
            dnw.ˎ(fileInputStream);
            throw th2;
        }
    }
}
